﻿using System.Text.Json.Nodes;

namespace SMCL.Core.Utils.Types
{
    public class AssetIndex_Object
    {
        public string Name { get; private set; }
        public string Hash { get; private set; }
        public int Size { get; private set; }
        public Uri Url { get; private set; }
        public string Path { get; private set; }
        public AssetIndex_Object(KeyValuePair<string, JsonNode> node)
        {
            Name = node.Key;
            Hash = node.Value["hash"].GetValue<string>();
            Size = node.Value["size"].GetValue<int>();
            Url = new($"https://bmclapi2.bangbang93.com/assets/{Hash[..2]}/{Hash}");
            Path = $"{Hash[..2]}\\{Hash}";
        }
    }
}
